home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / comm / misc / RecentScript.lha / RecentScript / RecentScriptCmd.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1998-03-15  |  33.5 KB  |  1,359 lines

  1. /*****
  2.   $VER: RecentScript Commands 1.7 (14.3.98) ©Arndt van der Molen
  3.  
  4.  
  5.                    RecentScript Commands
  6.  
  7.   is a MUIRexx subapplication and can not be started directly.
  8.  
  9.   It is called only from the starter application.
  10. *****/
  11.  
  12.  
  13.  
  14. /* Change to path with trailing ':' or '/' where this script resides */
  15. srcdir = 'MUIREXX:RecentScript/'
  16.  
  17.  
  18. /* !!! NOTHING TO CHANGE BELOW THIS LINE !!! */
  19.  
  20. MUIV_List_Select_Off      =  '0'
  21. MUIV_List_Select_On       =  '1'
  22.  
  23. OPTIONS RESULTS
  24.  
  25. PARSE ARG portname cmd1 cmd2 '['cmd3']'
  26. cmd2 = STRIP(cmd2)
  27.  
  28. PRAGMA('Directory',srcdir) /* Set current directory */
  29.  
  30. ADDRESS VALUE portname
  31.  
  32. IF ~SHOW('l', "rexxdossupport.library") THEN DO
  33.   IF ~ADDLIB('rexxdossupport.library',0,-30,0) THEN DO
  34.     request ID RECSCRWIN TITLE '"Library Error"' GADGETS '"_OK"' STRING "Could not load 'rexxdossupport.library'"
  35.     RETURN
  36.   END
  37. END
  38.  
  39. SELECT
  40.   WHEN cmd1 = 'ADD'          THEN CALL addentries
  41.   WHEN cmd1 = 'CLR'          THEN CALL clearlist cmd2
  42.   WHEN cmd1 = 'SAL'          THEN CALL selectlist cmd2
  43.   WHEN cmd1 = 'TGL'          THEN CALL togglelist cmd2
  44.   WHEN cmd1 = 'DAL'          THEN CALL deselectlist cmd2
  45.   WHEN cmd1 = 'DEL'          THEN CALL delentry
  46.   WHEN cmd1 = 'LOAD'         THEN CALL loadindex cmd2 cmd3
  47.   WHEN cmd1 = 'MINUS'        THEN CALL patternentries MUIV_List_Select_Off
  48.   WHEN cmd1 = 'PLUS'         THEN CALL patternentries MUIV_List_Select_On
  49.   WHEN cmd1 = 'SAVE'         THEN CALL savelist
  50.   WHEN cmd1 = 'SETBAT'       THEN CALL batchsettingopen '['cmd3']'
  51.   WHEN cmd1 = 'SETBATHDL'    THEN CALL batchsettinghandle cmd2 '['cmd3']'
  52.   WHEN cmd1 = 'LOADCFG'      THEN CALL loadconfig
  53.   WHEN cmd1 = 'SAVECFG'      THEN CALL saveconfig
  54.   WHEN cmd1 = 'SORT'         THEN CALL sortlist cmd2 cmd3
  55.   WHEN cmd1 = 'TEST'         THEN CALL testprocedure cmd2
  56.   WHEN cmd1 = 'SETFLT'       THEN CALL filtersettingopen
  57.   WHEN cmd1 = 'SETFLTHDL'    THEN CALL filtersettinghandle cmd2 '['cmd3']'
  58.   WHEN cmd1 = 'ABOUT'        THEN CALL about
  59.  
  60.   OTHERWISE DO
  61.     request ID RECSCRWIN TITLE '"Internal Error"' GADGETS '"_OK"' STRING 'Unsupport command "'cmd1 cmd2 cmd3'"'
  62.   END
  63. END
  64.  
  65. RETURN
  66.  
  67.  
  68.  
  69. /* --------------------------------------------------------- */
  70. /* Add all selected entries from the LST_ALL to the LST_SEL  */
  71. /* --------------------------------------------------------- */
  72.  
  73. addentries: PROCEDURE
  74.  
  75. MUIA_List_Quiet           = '0x8042d8c7'
  76. MUIA_List_Entries         = '0x80421654'
  77. MUIM_Busy_Move            = '0x80020001'
  78. MUIM_List_Jump            = '0x8042baab'
  79. MUIV_List_Insert_Bottom   = -3
  80.  
  81.  
  82. /* Disable both listviews for speedup */
  83. list ID LST_ALL ATTRS MUIA_List_Quiet 1
  84. list ID LST_SEL ATTRS MUIA_List_Quiet 1
  85.  
  86. DO FOREVER
  87.  
  88.   list ID LST_ALL
  89.   line = RESULT
  90.  
  91.   IF line = '' THEN LEAVE
  92.  
  93.   /* Remove (Most Downloaded/Top Rated) style from line */
  94.   IF SUBSTR(line,40,1) = '' THEN line = SUBSTR(line,1,39) || SUBSTR(line,42)
  95.  
  96.   method ID CLS_BUSY MUIM_Busy_Move
  97.  
  98.   list ID LST_SEL ATTRS MUIA_List_Entries
  99.   oldentries = RESULT
  100.  
  101.   /* Add entry if it is not a duplicate */
  102.   list ID LST_SEL NODUP POS MUIV_List_Insert_Bottom INSERT STRING line
  103.  
  104.   list ID LST_SEL ATTRS MUIA_List_Entries
  105.   newentries = RESULT
  106.  
  107.   /* Check if number of entries has changed */
  108.   IF newentries > oldentries
  109.   THEN DO
  110.  
  111.     /* Update entry counter */
  112.     text ID SFILES LABEL RIGHT(newentries, 5, '0')
  113.  
  114.     /* This line must be edited if the format of the index file changes */
  115.     PARSE VAR line WITH 31 size +4
  116.  
  117.     /* get kb counter */
  118.     text ID SKB
  119.     kByte = RESULT
  120.  
  121.     SELECT
  122.       WHEN RIGHT(size,1) = 'K' THEN kByte = kByte + LEFT(size,3)
  123.       WHEN RIGHT(size,1) = 'M' THEN kByte = kByte + TRUNC((LEFT(size,3) * 1024) + 0.5)
  124.     END
  125.  
  126.     /* Update kb counter */
  127.     text ID SKB LABEL RIGHT(kByte, 6, '0')
  128.   END
  129.  
  130. END
  131.  
  132. /* Enable both listviews for input again */
  133. list ID LST_ALL ATTRS MUIA_List_Quiet 0
  134. list ID LST_SEL ATTRS MUIA_List_Quiet 0
  135.  
  136. RETURN
  137.  
  138.  
  139.  
  140. /* --------------------------------------------------------- */
  141. /* Delete selected entry from the LST_SEL                    */
  142. /* --------------------------------------------------------- */
  143.  
  144. delentry: PROCEDURE
  145.  
  146. MUIA_List_Active          = '0x8042391c'
  147. MUIA_List_Entries         = '0x80421654'
  148. MUIM_Busy_Move            = '0x80020001'
  149.  
  150.  
  151. method ID CLS_BUSY MUIM_Busy_Move
  152.  
  153. /* Get position to delete */
  154. list ID LST_SEL ATTRS MUIA_List_Active
  155. position = RESULT
  156.  
  157.  
  158. /* Get line content to delete */
  159. list ID LST_SEL POS position
  160. line = RESULT
  161.  
  162.  
  163. /* Delete line in list */
  164. list ID LST_SEL POS position STRING
  165.  
  166.  
  167. /* Update counters */
  168. list ID LST_SEL ATTRS MUIA_List_Entries
  169. newentries = RESULT
  170. text ID SFILES LABEL RIGHT(newentries, 5, '0')
  171.  
  172. text ID SKB
  173. kByte = RESULT
  174.  
  175. /* This line must be edited if the format of the index file changes */
  176. PARSE VAR line WITH 31 size +4
  177.  
  178. SELECT
  179.   WHEN RIGHT(size,1) = 'K' THEN kByte = kByte - LEFT(size,3)
  180.   WHEN RIGHT(size,1) = 'M' THEN kByte = kByte - TRUNC((LEFT(size,3) * 1024) + 0.5)
  181. END
  182.  
  183. text ID SKB LABEL RIGHT(kByte, 6, '0')
  184.  
  185. RETURN
  186.  
  187.  
  188.  
  189. /* --------------------------------------------------------- */
  190. /* Load specified AmiNet index file into specified listview  */
  191. /* --------------------------------------------------------- */
  192.  
  193. loadindex: PROCEDURE EXPOSE srcdir portname
  194.  
  195. parse arg listid ' ' filename
  196.  
  197. MUIA_List_Quiet           = '0x8042d8c7'
  198. MUIA_List_Entries         = '0x80421654'
  199. MUIA_Menuitem_Checked     = '0x8042562a'
  200. MUIM_Busy_Move            = '0x80020001'
  201. ASLFR_InitialDrawer       = '0x80080009'
  202. MUIV_List_Insert_Bottom   = -3
  203.  
  204.  
  205.  
  206. IF filename = '' THEN DO
  207.  
  208.   IF listid = 'LST_ALL' THEN DO
  209.     cycle ID CYC_ALL
  210.   END
  211.   ELSE DO
  212.     cycle ID CYC_SEL
  213.   END
  214.   loadmode = RESULT
  215.  
  216.   IF loadmode = 'File' THEN DO
  217.  
  218.     /* Get filename via requestor */
  219.  
  220.     OPTIONS FAILAT 11
  221.     aslrequest ID RECSCRWIN TITLE '"Load AmiNet index file..."' ATTRS ASLFR_InitialDrawer srcdir
  222.     returncode = RC
  223.     filename   = RESULT
  224.     OPTIONS FAILAT 10
  225.  
  226.     IF returncode ~= 0 | filename = '' THEN DO
  227.       RETURN
  228.     END
  229.   END
  230.   ELSE DO
  231.  
  232.     /* Get filename via Importer */
  233.  
  234.     CALL PRAGMA('Directory', srcdir || "Importers")
  235.  
  236.     importercall = 'CALL 'loadmode portname
  237.     interpret importercall
  238.     filename = RESULT
  239.  
  240.     CALL PRAGMA('Directory',srcdir)
  241.  
  242.     IF filename = 'RESULT' THEN DO
  243.       RETURN
  244.     END
  245.   END
  246. END
  247.  
  248.  
  249. /* Exclude non-interest directories via AminetFilter? */
  250. item ID MEN_AMF ATTRS MUIA_Menuitem_Checked
  251. filter = RESULT
  252. IF filter = 1 THEN DO
  253.  
  254.   /* Create temporary file because AminetFilter modifies the original */
  255.   getvar AMF_TEMP
  256.   tempfile = RESULT || FILEPART(filename)
  257.   ADDRESS COMMAND 'copy >NIL: "'filename'" "'tempfile'"'
  258.  
  259.   getvar AMF_PATT
  260.   pattern = RESULT
  261.  
  262.   getvar AMF_PATH
  263.   cmd_str = RESULT || " " || tempfile || " " || pattern || " NS"
  264.  
  265.   ADDRESS COMMAND cmd_str
  266.   filename = tempfile
  267. END
  268.  
  269.  
  270. /* Read new index file */
  271. IF OPEN(indexhandle, filename, 'R') THEN DO
  272.  
  273.   /* Append new files or clear old list? */
  274.   list ID listid ATTRS MUIA_List_Entries
  275.   oldentries = RESULT
  276.  
  277.   IF oldentries > 0 THEN DO
  278.     request ID RECSCRWIN TITLE '"Decision..."' GADGETS '"_Yes|_No"' STRING 'Replace old list?'
  279.  
  280.     IF RESULT = 1 THEN DO
  281.       CALL clearlist listid
  282.     END
  283.   END
  284.  
  285.   list ID listid ATTRS MUIA_List_Quiet 1
  286.  
  287.   style = ""
  288.  
  289.   DO UNTIL EOF(indexhandle)
  290.  
  291.     method ID CLS_BUSY MUIM_Busy_Move
  292.  
  293.     line = READLN(indexhandle)
  294.  
  295.  
  296.     /* Check for introducer of "Most Downloaded" and "Top Rated" archives */
  297.     IF      SUBSTR(line,1,10) = "| The most" THEN style = "\033i"
  298.     ELSE IF SUBSTR(line,1,10) = "| The high" THEN style = "\033b"
  299.  
  300.     /* Check if the line is an AmiNet Index line */
  301.  
  302.     slashposition = POS('/',line)
  303.  
  304.     /* This check must be edited if the format of the index file changes */
  305.     IF    (SUBSTR(line,34,1) = 'K' | SUBSTR(line,34,1) = 'M'),
  306.         & SUBSTR(line,19,1)  = ' ',
  307.         & SUBSTR(line,30,1)  = ' ',
  308.         & slashposition > 20,
  309.         & slashposition < 29
  310.     THEN DO
  311.  
  312.       /* Change all comma to semicolon due to MUIRexx flaw */
  313.       line = TRANSLATE(line, ";", ",")
  314.  
  315.       /* Check for AGE column and parse accordingly */
  316.       IF DATATYPE(SUBSTR(line,36,3), 'WHOLE') = 1 & SUBSTR(line,35,1) = ' '
  317.       THEN DO
  318.         /* This line must be edited if the format of the index file changes */
  319.         PARSE VAR line WITH 1 name +18 WITH 20 directory +10 WITH 31 size +4 WITH 36 age +3 WITH 40 comment
  320.       END
  321.       ELSE DO
  322.         /* This line must be edited if the format of the index file changes */
  323.         PARSE VAR line WITH 1 name +18 WITH 20 directory +10 WITH 31 size +4 WITH 36 comment
  324.         age = "  0"
  325.       END
  326.  
  327.       list ID listid ATTRS MUIA_List_Entries
  328.       oldentries = RESULT
  329.  
  330.       list ID listid NODUP POS MUIV_List_Insert_Bottom INSERT STRING name","directory","size","age","style||comment
  331.  
  332.       list ID listid ATTRS MUIA_List_Entries
  333.       newentries = RESULT
  334.  
  335.       /* Check if number of entries has changed */
  336.       IF newentries > oldentries
  337.       THEN DO
  338.  
  339.         SELECT
  340.           WHEN RIGHT(size,1) = 'K' THEN kByte = LEFT(size,3)
  341.           WHEN RIGHT(size,1) = 'M' THEN kByte = TRUNC((LEFT(size,3) * 1024) + 0.5)
  342.         END
  343.  
  344.         IF listid = 'LST_ALL'
  345.         THEN DO
  346.           text ID AFILES LABEL RIGHT(newentries, 5, '0')
  347.  
  348.           text ID AKB
  349.           kByte = kbyte + RESULT
  350.           text ID AKB LABEL RIGHT(kByte, 6, '0')
  351.         END
  352.         ELSE DO
  353.           text ID SFILES LABEL RIGHT(newentries, 5, '0')
  354.  
  355.           text ID SKB
  356.           kByte = kbyte + RESULT
  357.           text ID SKB LABEL RIGHT(kByte, 6, '0')
  358.         END
  359.       END
  360.     END
  361.   END
  362.  
  363.   list ID listid ATTRS MUIA_List_Quiet 0
  364.  
  365.   CALL CLOSE(indexhandle)
  366.  
  367.   IF filter = 1 THEN DO
  368.     ADDRESS COMMAND 'delete >NIL: "'tempfile'"'
  369.   END
  370.  
  371. END
  372. ELSE DO
  373.   request ID RECSCRWIN TITLE '"File Error"' GADGETS "_OK" STRING "Cannot read file '"filename"'"
  374. END
  375.  
  376. RETURN
  377.  
  378.  
  379.  
  380. /* --------------------------------------------------------- */
  381. /* Save LST_SEL to AmiNet index file or user defined batch   */
  382. /* --------------------------------------------------------- */
  383.  
  384. savelist: PROCEDURE EXPOSE srcdir
  385.  
  386. MUIA_List_Entries         = '0x80421654'
  387. MUIA_Menuitem_Checked     = '0x8042562a'
  388. MUIM_Busy_Move            = '0x80020001'
  389. ASLFR_InitialFile         = '0x80080008'
  390. ASLFR_InitialDrawer       = '0x80080009'
  391.  
  392.  
  393. /* Get batchmode */
  394.  
  395. cycle ID CYC_BAT
  396. batchmode = RESULT
  397.  
  398. /* Save to AmiNet Index file ? */
  399.  
  400. IF batchmode = 'AmiNet Index' THEN DO
  401.   CALL saveasindex
  402.   RETURN
  403. END
  404.  
  405. /* A user defined batchmode is selected... */
  406.  
  407. /* Read batchmode settings in local stem */
  408.  
  409. IF loadbatchsetting('['batchmode']') = 1 THEN DO
  410.  
  411.   IF batchcfg.exec ~= 'Always' THEN DO
  412.  
  413.     locdir  = PATHPART(batchcfg.file)
  414.     locfile = FILEPART(batchcfg.file)
  415.  
  416.     IF locdir = "" THEN locdir = srcdir
  417.  
  418.     OPTIONS FAILAT 11
  419.     aslrequest ID RECSCRWIN TITLE '"Save 'batchmode' file..."' ATTRS ASLFR_InitialDrawer locdir ASLFR_InitialFile locfile
  420.     returncode = RC
  421.     outputfilename = RESULT
  422.     OPTIONS FAILAT 10
  423.  
  424.     IF returncode ~= 0 | outputfilename = '' THEN DO
  425.       RETURN
  426.     END
  427.   END
  428.   ELSE DO
  429.     outputfilename = batchcfg.file
  430.   END
  431.  
  432.  
  433.   IF OPEN(writehandle, outputfilename, 'W') THEN DO
  434.  
  435.     /* Read and Write batchmode intro file if available */
  436.  
  437.     filename = srcdir || "Configs/" || batchmode || ".intro"
  438.  
  439.     IF OPEN(handle, filename, 'R') THEN DO
  440.  
  441.       /* Do for all lines in file */
  442.       DO UNTIL EOF(handle)
  443.       
  444.         method ID CLS_BUSY MUIM_Busy_Move
  445.  
  446.         line = READLN(handle)
  447.  
  448.         /* Replace batch placeholders with value from config */
  449.         DO i=1 TO (batchvar.0)
  450.  
  451.           /* Replace all placeholders in line */
  452.           start = POS(batchvar.i.replace, line)
  453.           DO WHILE start ~= 0
  454.  
  455.             line  = SUBSTR(line,1,start-1) || SUBSTR(line,start+2)
  456.             line  = INSERT(batchvar.i.val, line, start-1)
  457.             start = POS(batchvar.i.replace, line)
  458.           END
  459.     
  460.         END
  461.  
  462.         CALL WRITELN(writehandle, line)
  463.       END
  464.  
  465.       CALL CLOSE(handle)
  466.     END
  467.  
  468.  
  469.     /* Read and Write batchmode entry file if available */
  470.  
  471.     filename = srcdir || "Configs/" || batchmode || ".entry"
  472.  
  473.     IF OPEN(handle, filename, 'R') THEN DO
  474.  
  475.       /* Add entry placeholders to local stem varaible */
  476.       i = batchvar.0 + 1
  477.       batchvar.i.replace = '%n'     /* name       */
  478.       i = i+1
  479.       batchvar.i.replace = '%N'     /* name+      */
  480.       i = i+1
  481.       batchvar.i.replace = '%d'     /* directory  */
  482.       i = i+1
  483.       batchvar.i.replace = '%D'     /* directory+ */
  484.       i = i+1
  485.       batchvar.i.replace = '%s'     /* size       */
  486.       i = i+1
  487.       batchvar.i.replace = '%S'     /* size+      */
  488.       i = i+1
  489.       batchvar.i.replace = '%a'     /* age        */
  490.       i = i+1
  491.       batchvar.i.replace = '%A'     /* age+       */
  492.       i = i+1
  493.       batchvar.i.replace = '%c'     /* comment    */
  494.       i = i+1
  495.       batchvar.i.replace = '%C'     /* comment+   */
  496.       batchvar.0 = i
  497.  
  498.       /* Read batchmode entry lines in local stem variable */
  499.  
  500.       entrycfg.0 = 0
  501.       i = 1
  502.  
  503.       DO UNTIL EOF(handle)
  504.   
  505.         method ID CLS_BUSY MUIM_Busy_Move
  506.  
  507.         entrycfg.i = READLN(handle)
  508.         entrycfg.0 = i
  509.         i = i + 1
  510.       END
  511.  
  512.       CALL CLOSE(handle)
  513.  
  514.       /* Do for all entries in LST_SEL */
  515.  
  516.       list ID LST_SEL ATTRS MUIA_List_Entries
  517.       lstselcount = RESULT
  518.  
  519.       IF lstselcount > 0 THEN DO
  520.  
  521.         DO lstselnr=0 TO lstselcount-1
  522.  
  523.           method ID CLS_BUSY MUIM_Busy_Move
  524.  
  525.           list ID LST_SEL POS lstselnr
  526.           listline = RESULT
  527.  
  528.           /* This line must be edited if the format of the index file changes */
  529.           PARSE VAR listline WITH 1 name +18 WITH 20 directory +10 WITH 31 size +4 WITH 36 age +3 WITH 40 comment +44
  530.  
  531.           /* Add entry values to local stem variable */
  532.           i = batchvar.0 + 1 - 10 
  533.  
  534.           batchvar.i.val = STRIP(name)
  535.           i = i+1
  536.           batchvar.i.val = name
  537.           i = i+1
  538.           batchvar.i.val = STRIP(directory)
  539.           i = i+1
  540.           batchvar.i.val = directory
  541.           i = i+1
  542.           batchvar.i.val = STRIP(size)
  543.           i = i+1
  544.           batchvar.i.val = size
  545.           i = i+1
  546.           batchvar.i.val = STRIP(age)
  547.           i = i+1
  548.           batchvar.i.val = age
  549.           i = i+1
  550.           batchvar.i.val = comment
  551.           i = i+1
  552.           batchvar.i.val = SUBSTR(comment, 1, 44, ' ')
  553.  
  554.  
  555.           DO global=0 TO batchcfg.readme  /* Process *.readme file ? */
  556.  
  557.             IF global=1 THEN DO
  558.  
  559.               i        = batchvar.0 - 4  /* Set new 'size' to 0 */
  560.               batchvar.i.val = '  0K'
  561.  
  562.               i        = batchvar.0 - 5  /* Set new 'size+' to 0 */
  563.               batchvar.i.val = '0K'
  564.  
  565.               i        = batchvar.0 - 9    /* Set new 'name' to *.readme */
  566.               position = LASTPOS('.', batchvar.i.val)
  567.  
  568.               IF position ~= 0 THEN DO
  569.                 batchvar.i.val = SUBSTR(batchvar.i.val, 1, position) || "readme"
  570.               END
  571.               ELSE DO
  572.                 batchvar.i.val = batchvar.i.val || ".readme"
  573.               END
  574.  
  575.               j = batchvar.0 - 8    /* Set new 'name+' to *.readme */
  576.               batchvar.j.val = SUBSTR(batchvar.i.val, 1, 18, ' ');
  577.             END
  578.  
  579.             /* Do for all entry config lines */
  580.  
  581.             DO entrycfgnr=1 TO entrycfg.0
  582.  
  583.               line = entrycfg.entrycfgnr
  584.  
  585.               /* Replace batch and entry placeholders with value from config */
  586.               DO i=1 TO batchvar.0
  587.  
  588.                 /* Replace all placeholders in line */
  589.                 start = POS(batchvar.i.replace, line)
  590.                 DO WHILE start ~= 0
  591.  
  592.                   line  = SUBSTR(line,1,start-1) || SUBSTR(line,start+2)
  593.                   line  = INSERT(batchvar.i.val, line, start-1)
  594.                   start = POS(batchvar.i.replace, line)
  595.                 END
  596.               END
  597.  
  598.               CALL WRITELN(writehandle, line)
  599.             END
  600.           END
  601.         END
  602.       END
  603.       batchvar.0 = batchvar.0 - 10  /* Remove entry variables from config */
  604.     END
  605.  
  606.  
  607.     /* Read and Write batchmode extro file if available */
  608.  
  609.     filename = srcdir || "Configs/" || batchmode || ".extro"
  610.  
  611.     IF OPEN(handle, filename, 'R') THEN DO
  612.  
  613.       /* Do for all lines in file */
  614.       DO UNTIL EOF(handle)
  615.       
  616.         method ID CLS_BUSY MUIM_Busy_Move
  617.  
  618.         line = READLN(handle)
  619.  
  620.         /* Replace batch placeholders with value from config */
  621.         DO i=1 TO (batchvar.0)
  622.  
  623.           /* Replace all placeholders in line */
  624.           start = POS(batchvar.i.replace, line)
  625.           DO WHILE start ~= 0
  626.  
  627.             line  = SUBSTR(line,1,start-1) || SUBSTR(line,start+2)
  628.             line  = INSERT(batchvar.i.val, line, start-1)
  629.             start = POS(batchvar.i.replace, line)
  630.           END
  631.         END
  632.  
  633.         CALL WRITELN(writehandle, line)
  634.       END
  635.  
  636.       CALL CLOSE(handle)
  637.     END
  638.  
  639.     CALL CLOSE(writehandle)
  640.  
  641.  
  642.     /* Copy icon for batchfile if available */
  643.     allfiles = showdir(srcdir || 'Configs', 'f', ';')
  644.  
  645.     IF INDEX(allfiles, batchmode".info") ~= 0 THEN DO
  646.       ADDRESS COMMAND 'copy >NIL: "'srcdir'Configs/'batchmode'.info" "'outputfilename'.info"'
  647.     END
  648.  
  649.  
  650.     /* Replace all filename placeholders in commandline */
  651.     cmd_string = batchcfg.cmd
  652.  
  653.     start = POS("%o", cmd_string)
  654.     DO WHILE start ~= 0
  655.       cmd_string  = SUBSTR(cmd_string,1,start-1) || SUBSTR(cmd_string,start+2)
  656.       cmd_string  = INSERT(outputfilename, cmd_string, start-1)
  657.       start = POS("%o", cmd_string)
  658.     END
  659.  
  660.  
  661.     SELECT
  662.  
  663.       WHEN batchcfg.exec = 'Never' THEN DO
  664.       END
  665.  
  666.       WHEN batchcfg.exec = 'Always' THEN DO
  667.         OPTIONS FAILAT 21
  668.         ADDRESS COMMAND cmd_string
  669.         OPTIONS FAILAT 10
  670.       END
  671.  
  672.       OTHERWISE DO
  673.  
  674.         request ID RECSCRWIN TITLE 'Execute?' GADGETS '_Yes|_No' STRING 'Process output via\n\n\033b'cmd_string'\033n\n\ncommand now?'
  675.  
  676.         IF RESULT = 1 THEN DO
  677.           OPTIONS FAILAT 21
  678.           ADDRESS COMMAND cmd_string
  679.           OPTIONS FAILAT 10
  680.         END
  681.       END
  682.     END
  683.  
  684.   END
  685.   ELSE DO
  686.     request ID RECSCRWIN TITLE '"File Error"' GADGETS "_OK" STRING "Cannot write file '"outputfilename"'"
  687.     RETURN
  688.   END
  689.  
  690.   /* Get 'Quit after save' setting */
  691.   item ID MEN_QAS ATTRS MUIA_Menuitem_Checked
  692.  
  693.   IF RESULT = 1 THEN DO
  694.     QUIT
  695.   END
  696.  
  697. END
  698. ELSE DO
  699.   request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot read '"batchmode"' configuration"
  700. END
  701.  
  702. RETURN
  703.  
  704.  
  705.  
  706. /* --------------------------------------------------------- */
  707. /* Save all entries from the LST_SEL to an AmiNet index file */
  708. /* --------------------------------------------------------- */
  709.  
  710. saveasindex: PROCEDURE EXPOSE srcdir
  711.  
  712. MUIA_List_Entries         = '0x80421654'
  713. MUIM_Busy_Move            = '0x80020001'
  714. ASLFR_InitialFile         = '0x80080008'
  715. ASLFR_InitialDrawer       = '0x80080009'
  716.  
  717.  
  718. OPTIONS FAILAT 11
  719. aslrequest ID RECSCRWIN TITLE '"Save AmiNet index file..."' ATTRS ASLFR_InitialDrawer srcdir ASLFR_InitialFile "RecentScript.lst"
  720. returncode = RC
  721. filename   = RESULT
  722. OPTIONS FAILAT 10
  723.  
  724. IF returncode = 0 & filename ~= '' THEN DO
  725.  
  726.   IF OPEN(handle, filename, 'W') THEN DO
  727.  
  728.     list ID LST_SEL ATTRS MUIA_List_Entries
  729.     number = RESULT
  730.  
  731.     IF number > 0 THEN DO
  732.  
  733.       DO i=0 TO number-1
  734.  
  735.         method ID CLS_BUSY MUIM_Busy_Move
  736.  
  737.         list ID LST_SEL POS i
  738.         line = RESULT
  739.  
  740.         /* This line must be edited if the format of the index file changes */
  741.         PARSE VAR line WITH 1 name +18 WITH 20 directory +10 WITH 31 size +4 WITH 36 age +3 WITH 40 comment
  742.  
  743.         CALL WRITELN(handle,name directory size age comment)
  744.       END
  745.     END
  746.  
  747.     CALL CLOSE(handle)
  748.   END
  749.   ELSE DO
  750.     request ID RECSCRWIN TITLE '"File Error"' GADGETS "_OK" STRING "'Cannot write file '"filename"'"
  751.   END
  752. END
  753.  
  754.  
  755. RETURN
  756.  
  757.  
  758.  
  759. /* --------------------------------------------------------- */
  760. /* Delete all entries in specified listview                  */
  761. /* --------------------------------------------------------- */
  762.  
  763. clearlist: PROCEDURE
  764.  
  765. parse arg listid
  766.  
  767. list ID listid STRING
  768.  
  769. IF listid = 'LST_ALL'
  770. THEN DO
  771.   text ID AFILES LABEL RIGHT(0, 5, '0')
  772.   text ID AKB    LABEL RIGHT(0, 6, '0')
  773. END
  774. ELSE DO
  775.   text ID SFILES LABEL RIGHT(0, 5, '0')
  776.   text ID SKB    LABEL RIGHT(0, 6, '0')
  777. END
  778.  
  779. RETURN
  780.  
  781.  
  782.  
  783. /* --------------------------------------------------------- */
  784. /* Select all entries in specified listview                  */
  785. /* --------------------------------------------------------- */
  786.  
  787. selectlist: PROCEDURE
  788.  
  789. parse arg listid
  790.  
  791. MUIM_List_Select          = '0x804252d8'
  792. MUIV_List_Select_All      = '-2'
  793. MUIV_List_Select_On       = '1'
  794.  
  795. method ID listid MUIM_List_Select MUIV_List_Select_All MUIV_List_Select_On 0
  796.  
  797. RETURN
  798.  
  799.  
  800.  
  801. /* --------------------------------------------------------- */
  802. /* Toggle all entries in specified listview                  */
  803. /* --------------------------------------------------------- */
  804.  
  805. togglelist: PROCEDURE
  806.  
  807. parse arg listid
  808.  
  809. list ID listid TOGGLE
  810.  
  811. RETURN
  812.  
  813.  
  814.  
  815. /* --------------------------------------------------------- */
  816. /* Deselect all entries in specified listview                */
  817. /* --------------------------------------------------------- */
  818.  
  819. deselectlist: PROCEDURE
  820.  
  821. parse arg listid
  822.  
  823. MUIM_List_Select          = '0x804252d8'
  824. MUIV_List_Select_All      = '-2'
  825. MUIV_List_Select_Off      = '0'
  826.  
  827. method ID listid MUIM_List_Select MUIV_List_Select_All MUIV_List_Select_Off 0
  828.  
  829. RETURN
  830.  
  831.  
  832.  
  833. /* --------------------------------------------------------- */
  834. /* (De)Select entries in LST_ALL with search string          */
  835. /* --------------------------------------------------------- */
  836.  
  837. patternentries: PROCEDURE
  838.  
  839. parse arg mode
  840.  
  841. MUIA_List_Quiet           = '0x8042d8c7'
  842. MUIA_List_Entries         = '0x80421654'
  843. MUIM_List_Select          = '0x804252d8'
  844. MUIM_Busy_Move            = '0x80020001'
  845.  
  846. list ID LST_ALL ATTRS MUIA_List_Entries
  847. number = RESULT
  848.  
  849. IF number > 0 THEN DO
  850.  
  851.   string ID STR_PATT
  852.   pattern = UPPER(RESULT)
  853.  
  854.   list ID LST_ALL ATTRS MUIA_List_Quiet 1
  855.  
  856.   DO i=0 TO number-1
  857.  
  858.     method ID CLS_BUSY MUIM_Busy_Move
  859.  
  860.     list ID LST_ALL POS i
  861.     line = UPPER(RESULT)
  862.  
  863.     IF POS(pattern, line) ~= 0 THEN DO
  864.  
  865.       method ID LST_ALL MUIM_List_Select i mode 0
  866.     END
  867.   END
  868.  
  869.   list ID LST_ALL ATTRS MUIA_List_Quiet 0
  870. END
  871.  
  872. RETURN
  873.  
  874.  
  875.  
  876. /* --------------------------------------------------------- */
  877. /* Opens batch settings window for the specified batchmode   */
  878. /* --------------------------------------------------------- */
  879.  
  880. batchsettingopen: PROCEDURE EXPOSE portname srcdir
  881.  
  882. parse arg '['batchmode']'
  883.  
  884. /* Strip '...' from batchmode string */
  885. batchmode = LEFT(batchmode, LENGTH(batchmode)-3)
  886.  
  887.  
  888. MUIA_Selected             = '0x8042654b'
  889. MUIA_Weight               = '0x80421d1f'
  890.  
  891. /* GUI Help Bubbles */
  892.  
  893. HLP_BUT_DESC   = '"Shows batchmode description if available"'
  894. HLP_CHK_README = '"Generate additional entry for the ''.readme'' file ?"'
  895. HLP_ASL_FILE   = '"Defines default filename for saving.\nDo NOT use Spaces!"'
  896. HLP_CYC_EXEC   = '"Defines whether the script should\nbe started after saving"'
  897. HLP_ASL_CMD    = '"Defines the DOS command to execute the output.\nVariable ''%o'' will be replaced by path and name of the output."'
  898.  
  899. /* GUI Commands */
  900.  
  901. CMD_BUT_SAVE   = '"'srcdir'RecentScriptCmd 'portname' SETBATHDL SAVE   ['batchmode']"'
  902. CMD_BUT_CANCEL = '"'srcdir'RecentScriptCmd 'portname' SETBATHDL CANCEL ['batchmode']"'
  903. CMD_BUT_DESC   = '"'srcdir'RecentScriptCmd 'portname' SETBATHDL DESC   ['batchmode']"'
  904.  
  905.  
  906. /* Read global batchmode config in local stem vraiable */
  907.  
  908. IF loadbatchsetting('['batchmode']') = 1 THEN DO
  909.  
  910.   asdf = 'endgroup'  /* Workaround for an interpreting error (?) */
  911.  
  912.   /* Create window */
  913.  
  914.   window ID BATSETWIN TITLE '"'batchmode'"' PORT portname
  915.  
  916.     button COMMAND CMD_BUT_DESC HELP HLP_BUT_DESC LABEL 'Description...' 
  917.  
  918.     group FRAME LABEL 'Global'
  919.       group HORIZ
  920.         space HORIZ
  921.         check ID CHK_README ATTRS MUIA_Selected batchcfg.readme HELP HLP_CHK_README
  922.         label  "Include '#?.readme'"
  923.         space HORIZ
  924.       endgroup
  925.       group HORIZ
  926.         label  "Save to"
  927.         popasl ID ASL_FILE HELP HLP_ASL_FILE CONTENT batchcfg.file
  928.       endgroup
  929.       group HORIZ
  930.         cycle ID CYC_EXEC ATTRS MUIA_Weight 0 HELP HLP_CYC_EXEC LABELS 'Never,Ask,Always'
  931.         label  "execute script via"
  932.         popasl ID ASL_CMD HELP HLP_ASL_CMD CONTENT batchcfg.cmd
  933.       endgroup
  934.     endgroup
  935.  
  936.     group FRAME LABEL 'Configuration Variables'
  937.  
  938.       IF batchvar.0 = 0 THEN DO
  939.         text LABEL '\033cNo user variables defined.'
  940.       END
  941.       ELSE DO
  942.         
  943.         group SCROLL
  944.  
  945.           /* Create string gadgets for each user variable */
  946.  
  947.           DO i=1 TO batchvar.0
  948.             group ID '"G'D2C(i+65)'"'
  949.               label CENTER '"'batchvar.i.desc'"'
  950.               group HORIZ
  951.                 label batchvar.i.replace
  952.                 string ID '"S'D2C(i+65)'"' HELP '"Replaces configuration variable ''%'D2C(i+48)''' in output"' CONTENT batchvar.i.val
  953.               interpret asdf
  954.             interpret asdf
  955.           END i
  956.         endgroup
  957.       END
  958.     endgroup
  959.  
  960.     group HORIZ
  961.       button COMMAND CMD_BUT_SAVE   LABEL 'Save'
  962.       button COMMAND CMD_BUT_CANCEL LABEL 'Cancel'
  963.     endgroup
  964.  
  965.   endwindow
  966.  
  967.   cycle ID CYC_EXEC LABELS batchcfg.exec
  968.  
  969. END
  970. ELSE DO
  971.   request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot read '"batchmode"' configuration"
  972. END
  973.  
  974. RETURN
  975.  
  976.  
  977.  
  978. /* --------------------------------------------------------- */
  979. /* Handle buttons from the batch settings window             */
  980. /* --------------------------------------------------------- */
  981.  
  982. batchsettinghandle: PROCEDURE expose srcdir portname
  983.  
  984. parse arg mode '['batchmode']'
  985.  
  986. MUIM_Busy_Move            = '0x80020001'
  987.  
  988.  
  989. SELECT
  990.  
  991.   WHEN mode = 'DESC' THEN DO
  992.  
  993.    window ID HELPWIN CLOSE
  994.  
  995.    window ID HELPWIN TITLE '"Description of '''batchmode'''"' COMMAND '"window ID HELPWIN CLOSE"' PORT portname
  996.  
  997.      filename = srcdir || "Configs/" || batchmode || ".hlp"
  998.  
  999.      IF OPEN(handle, filename, 'R') THEN DO
  1000.        view ID HELPVIEW FILE '"'filename'"'
  1001.        CALL CLOSE(handle)
  1002.      END
  1003.      ELSE DO
  1004.        view ID HELPVIEW STRING "Sorry, no help available.\n\nContact the author of the configuration to provide it..."
  1005.      END
  1006.  
  1007.    endwindow
  1008.   END
  1009.  
  1010.  
  1011.   WHEN mode = 'CANCEL' THEN DO
  1012.     window ID BATSETWIN CLOSE
  1013.   END
  1014.  
  1015.   WHEN mode = 'SAVE' THEN DO
  1016.  
  1017.     /* Save global and variable configs to file */
  1018.  
  1019.     /* Read global config for description in local stem */
  1020.  
  1021.     IF loadbatchsetting('['batchmode']') = 1 THEN DO
  1022.  
  1023.       /* Get new global config values in local stem */
  1024.  
  1025.       check ID CHK_README
  1026.       batchcfg.readme = RESULT
  1027.       popasl ID ASL_FILE
  1028.       batchcfg.file = RESULT
  1029.       cycle ID CYC_EXEC
  1030.       batchcfg.exec = RESULT
  1031.       popasl ID ASL_CMD
  1032.       batchcfg.cmd = RESULT
  1033.  
  1034.       /* Write global config to file */
  1035.  
  1036.       filename = srcdir || "Configs/" || batchmode || ".cfg"
  1037.  
  1038.       IF OPEN(handle, filename, 'W') THEN DO
  1039.         CALL WRITELN(handle, batchcfg.readme)
  1040.         CALL WRITELN(handle, batchcfg.file)
  1041.         CALL WRITELN(handle, batchcfg.exec)
  1042.         CALL WRITELN(handle, batchcfg.cmd)
  1043.         CALL CLOSE(handle)
  1044.       END
  1045.       ELSE DO
  1046.         request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot write file '"filename"'"
  1047.       END
  1048.  
  1049.  
  1050.       filename = srcdir || "Configs/" || batchmode || ".var"
  1051.  
  1052.       /* Write variable batchmode config to file */
  1053.  
  1054.       IF OPEN(handle, filename, 'W') THEN DO
  1055.  
  1056.         DO i=1 TO batchvar.0
  1057.  
  1058.           method ID CLS_BUSY MUIM_Busy_Move
  1059.  
  1060.           string ID '"S'D2C(i+65)'"'
  1061.           batchvar.i.val = RESULT
  1062.  
  1063.           CALL WRITELN(handle, batchvar.i.desc)
  1064.           CALL WRITELN(handle, batchvar.i.val)
  1065.         END
  1066.  
  1067.         CALL CLOSE(handle)
  1068.       END
  1069.       ELSE DO
  1070.         request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot write file '"filename"'"
  1071.       END
  1072.     END
  1073.     ELSE DO
  1074.       request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot read '"batchmode"' configuration"
  1075.     END
  1076.  
  1077.     window ID BATSETWIN CLOSE
  1078.   END
  1079.  
  1080.   OTHERWISE DO
  1081.     request ID RECSCRWIN TITLE '"Internal Error"' GADGETS '"_OK"' STRING 'Unsupport command "'mode'"'
  1082.   END
  1083. END
  1084.  
  1085. RETURN
  1086.  
  1087.  
  1088.  
  1089. /* --------------------------------------------------------- */
  1090. /* Load config and variables of a batchmode setting          */
  1091. /* --------------------------------------------------------- */
  1092.  
  1093. loadbatchsetting: PROCEDURE EXPOSE srcdir batchcfg. batchvar.
  1094.  
  1095. parse arg '['batchmode']'
  1096.  
  1097. /* Read global batchmode config in local stem vraiable */
  1098.  
  1099. filename = srcdir || "Configs/" || batchmode || ".cfg"
  1100.  
  1101. IF OPEN(handle, filename, 'R') THEN DO
  1102.  
  1103.   batchcfg.readme = READLN(handle)
  1104.   batchcfg.file   = READLN(handle)
  1105.   batchcfg.exec   = READLN(handle)
  1106.   batchcfg.cmd    = READLN(handle)
  1107.  
  1108.   CALL CLOSE(handle)
  1109.  
  1110.  
  1111.   /* Read variable batchmode config in local stem variable */
  1112.  
  1113.   filename = srcdir || "Configs/" || batchmode || ".var"
  1114.  
  1115.   batchvar.0 = 0
  1116.  
  1117.   IF OPEN(handle, filename, 'R') THEN DO
  1118.  
  1119.     i = 0
  1120.  
  1121.     DO UNTIL EOF(handle)
  1122.  
  1123.       method ID CLS_BUSY MUIM_Busy_Move
  1124.  
  1125.       description = READLN(handle)
  1126.       value       = READLN(handle)
  1127.  
  1128.       IF description ~= "" | value ~= "" THEN DO
  1129.  
  1130.         i = i + 1
  1131.         batchvar.0 = i
  1132.  
  1133.         batchvar.i.replace = '%'D2C(i+48)''   /* %1 ... */
  1134.         batchvar.i.desc    = description
  1135.         batchvar.i.val     = value
  1136.       END
  1137.     END
  1138.  
  1139.     CALL CLOSE(handle)
  1140.   END
  1141.  
  1142.   RETURN 1
  1143.  
  1144. END
  1145. ELSE DO
  1146.   request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot read file '"filename"'"
  1147.   RETURN 0
  1148. END
  1149.  
  1150.  
  1151. /* --------------------------------------------------------- */
  1152. /* Load RecentScript configuration                           */
  1153. /* --------------------------------------------------------- */
  1154.  
  1155. loadconfig: PROCEDURE EXPOSE srcdir
  1156.  
  1157. MUIA_Menuitem_Checked     = '0x8042562a'
  1158.  
  1159.  
  1160. IF OPEN(readhandle, srcdir"RecentScript.cfg", 'R') THEN DO
  1161.  
  1162.   /* Get selected 'Save as' batchmode */
  1163.   line = READLN(readhandle)
  1164.   cycle ID CYC_BAT LABELS line
  1165.  
  1166.   /* Get 'Quit after save' setting */
  1167.   line = READLN(readhandle)
  1168.   item ID MEN_QAS ATTRS MUIA_Menuitem_Checked line
  1169.  
  1170.   /* Get selected AmiNet Index 'Import from' loadmode */
  1171.   line = READLN(readhandle)
  1172.   cycle ID CYC_ALL LABELS line
  1173.  
  1174.   /* Get selected Selected Files 'Import from' loadmode */
  1175.   line = READLN(readhandle)
  1176.   cycle ID CYC_SEL LABELS line
  1177.  
  1178.   /* Get 'AminetFilter Active' setting */
  1179.   line = READLN(readhandle)
  1180.   item ID MEN_AMF ATTRS MUIA_Menuitem_Checked line
  1181.  
  1182.  
  1183.   /* Get 'Aminet Filter Settings' and store in MUIRexx variables */
  1184.   setvar AMF_PATH READLN(readhandle)
  1185.   setvar AMF_TEMP READLN(readhandle)
  1186.   setvar AMF_PATT READLN(readhandle)
  1187.  
  1188.   CALL CLOSE(readhandle)
  1189. END
  1190.  
  1191. RETURN
  1192.  
  1193.  
  1194.  
  1195. /* --------------------------------------------------------- */
  1196. /* Save RecentScript configuration                           */
  1197. /* --------------------------------------------------------- */
  1198.  
  1199. saveconfig: PROCEDURE EXPOSE srcdir
  1200.  
  1201. MUIA_Menuitem_Checked     = '0x8042562a'
  1202.  
  1203.  
  1204. IF OPEN(writehandle, srcdir"RecentScript.cfg", 'W') THEN DO
  1205.  
  1206.   cycle ID CYC_BAT
  1207.   CALL WRITELN(writehandle, RESULT)
  1208.   item ID MEN_QAS ATTRS MUIA_Menuitem_Checked
  1209.   CALL WRITELN(writehandle, RESULT)
  1210.   cycle ID CYC_ALL
  1211.   CALL WRITELN(writehandle, RESULT)
  1212.   cycle ID CYC_SEL
  1213.   CALL WRITELN(writehandle, RESULT)
  1214.   item ID MEN_AMF ATTRS MUIA_Menuitem_Checked
  1215.   CALL WRITELN(writehandle, RESULT)
  1216.   getvar AMF_PATH
  1217.   CALL WRITELN(writehandle, RESULT)
  1218.   getvar AMF_TEMP
  1219.   CALL WRITELN(writehandle, RESULT)
  1220.   getvar AMF_PATT
  1221.   CALL WRITELN(writehandle, RESULT)
  1222.  
  1223.   CALL CLOSE(writehandle)
  1224. END
  1225.  
  1226. RETURN
  1227.  
  1228.  
  1229.  
  1230. /* --------------------------------------------------------- */
  1231. /* Sorts all entries in specified listview                   */
  1232. /* --------------------------------------------------------- */
  1233.  
  1234. sortlist: PROCEDURE
  1235.  
  1236. parse arg listid
  1237.  
  1238. MUIM_List_Sort            = '0x80422275'
  1239.  
  1240. method ID listid MUIM_List_Sort
  1241.  
  1242. RETURN
  1243.  
  1244.  
  1245.  
  1246. /* --------------------------------------------------------- */
  1247. /* Opens the AminetFilter settings window                    */
  1248. /* --------------------------------------------------------- */
  1249.  
  1250. filtersettingopen: PROCEDURE EXPOSE portname srcdir
  1251.  
  1252.  
  1253. /* GUI Commands */
  1254.  
  1255. CMD_BUT_OK     = '"'srcdir'RecentScriptCmd 'portname' SETFLTHDL OK"'
  1256. CMD_BUT_CANCEL = '"'srcdir'RecentScriptCmd 'portname' SETFLTHDL CANCEL"'
  1257.  
  1258.  
  1259. window ID FLTSETWIN TITLE '"AminetFilter"' PORT portname
  1260.  
  1261.   text LABEL '\033cThe feature to filter Aminet directories\nis done by the external program\n\033bAmiNetFilter\033n by ©Marcin Orlowski\n(comm/misc/AminetFilter.lha)'
  1262.  
  1263.   group FRAME
  1264.     group
  1265.       label CENTER '"AminetFilter executable"'
  1266.       getvar AMF_PATH
  1267.       popasl ID PATH CONTENT RESULT
  1268.  
  1269.       label CENTER '"Directory for temporary file"'
  1270.       getvar AMF_TEMP
  1271.       popasl ID TEMP CONTENT RESULT 
  1272.  
  1273.       label CENTER '"Directory pattern to exclude"'
  1274.       getvar AMF_PATT
  1275.       string ID PATT CONTENT RESULT
  1276.     endgroup
  1277.  
  1278.     group HORIZ
  1279.       button COMMAND CMD_BUT_OK     LABEL 'Ok'
  1280.       button COMMAND CMD_BUT_CANCEL LABEL 'Cancel'
  1281.     endgroup
  1282.   endgroup
  1283.  
  1284. endwindow
  1285.  
  1286. RETURN
  1287.  
  1288.  
  1289.  
  1290. /* --------------------------------------------------------- */
  1291. /* Handle buttons from the AminetFilter settings window      */
  1292. /* --------------------------------------------------------- */
  1293.  
  1294. filtersettinghandle: PROCEDURE expose srcdir portname
  1295.  
  1296. parse arg mode '['batchmode']'
  1297.  
  1298. MUIM_Busy_Move            = '0x80020001'
  1299.  
  1300.  
  1301. SELECT
  1302.  
  1303.   WHEN mode = 'CANCEL' THEN DO
  1304.     window ID FLTSETWIN CLOSE
  1305.   END
  1306.  
  1307.   WHEN mode = 'OK' THEN DO
  1308.  
  1309.     popasl ID PATH
  1310.     setvar AMF_PATH RESULT
  1311.     popasl ID TEMP
  1312.     setvar AMF_TEMP RESULT
  1313.     string ID PATT
  1314.     setvar AMF_PATT RESULT
  1315.  
  1316.     window ID FLTSETWIN CLOSE
  1317.   END
  1318.  
  1319.   OTHERWISE DO
  1320.     request ID RECSCRWIN TITLE '"Internal Error"' GADGETS '"_OK"' STRING 'Unsupport command "'mode'"'
  1321.   END
  1322. END
  1323.  
  1324. RETURN
  1325.  
  1326.  
  1327.  
  1328. /* --------------------------------------------------------- */
  1329. /* Opens the about window                                    */
  1330. /* --------------------------------------------------------- */
  1331.  
  1332. about: PROCEDURE expose srcdir portname
  1333.  
  1334. window ID RSABWIN TITLE 'About...'
  1335.   group
  1336.    group HORIZ
  1337.      space HORIZ
  1338.      button PICT '"'srcdir'internals/author.iff"'
  1339.      space HORIZ
  1340.    endgroup
  1341.    view FILE '"'srcdir'internals/about.txt"'
  1342.   endgroup
  1343.   button PRESS COMMAND '"window ID RSABWIN close"' PORT portname LABEL "Ok"
  1344. endwindow
  1345.  
  1346. RETURN
  1347.  
  1348.  
  1349.  
  1350. /* --------------------------------------------------------- */
  1351. /* Only a testprocedure for testing new features             */
  1352. /* --------------------------------------------------------- */
  1353.  
  1354. testprocedure: PROCEDURE expose srcdir portname
  1355.  
  1356. parse arg listid ' ' mode
  1357.  
  1358. RETURN
  1359.